<?php

/**
 * LEAGUEMan
 * 
 * Copyright (C) 2007 Marko Bischof
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

?>

<form action="index2.php" method="post" name="adminForm">
	<table cellpadding="4" cellspacing="0" border="0" width="100%">
		<tr>
			<td width="100%" class="sectionname">Positions</td>
			
			<?php if(!empty($this->typetemplate)){?>
			<td nowrap="nowrap">
				<fieldset>
					<legend>QuickAdd</legend>
					<input type="text" name="position_name"  size="25" value="" class="inputbox" />
					<input type="button" name="" class="button" value="Save" onClick="javascript:submitbutton('quickadd');" />
				</fieldset>
			</td>
			<?php } else { ?>
			<td nowrap="nowrap"><span style="color:#FF0000"><b>Select a Type for Quickadd-function!</b></span></td>
			<?php }?>
			
			<td>
				<fieldset>
					<legend>Filter</legend>
					<?php $this->plugin("leagueman_list", "templates", "typetemplate", $this->typetemplate, true);?>
				</fieldset>
			</td>
		</tr>
	</table>
	<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
		<tr>
			<th width="1%">
				<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->rows ); ?>);" />
			</th>
			<th width="5%">Id</th>
			<th width="40%" class="title"><?php echo 'Name';?></th>
			
			<?php if(!empty($this->typetemplate)){ ?>
			<th width="5%" class="title"><?php echo 'Ordering';?></th>
			<th>
				<a href="javascript: saveorder( <?php echo count( $this->rows ) - 1; ?> )">
					<img src="images/filesave.png" border="0" width="16" height="16" alt="Save Order" />
				</a>
			</th>
			<?php } ?>
			
			<th width="50%" class="title"><?php echo 'Projecttype';?></th>
			<th width="10%" colspan="2">&nbsp;</th>
		</tr>
<?php
	$k = 1;
	$i = 0;
	
	foreach($this->rows AS $row) {
		
		$position = LM::getLMTable("Position");
		$position->populate($row);
		
		$k = 1 - $k;
?>
		<tr class="<?php echo "row$k"; ?>">
			<td align="center">
        		<input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $position->getID(); ?>" onclick="isChecked(this.checked);" />
			</td>
			<td align="center"><b><?php echo $position->getID(); ?></b></td>
			<td>
				<a href="#edit" onclick="return listItemTask('cb<?php echo $i;?>','edit')">
					<?php echo $position->getName(); ?>
				</a>
			</td>
			<?php if(!empty($this->typetemplate)){ ?>
			<td colspan="2">
				<input type="text" name="ordering[]" size="5" value="<?php echo $position->getOrdering(); ?>" class="text_area" style="text-align: center" />
			</td>
			<?php } ?>
			<td><?php echo $position->getProjecttype();?></td>
			<td width="10%" align="center">&nbsp;</td>
		</tr>
<?php
		$i++;
	} 
?>
	</table>
	<?php echo $this->pageNav->getListFooter(); ?>
	<input type="hidden" name="option" value="com_leagueman" />
	<input type="hidden" name="act" value="positions" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="boxchecked" value="0" />
</form>